<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>
    function makeGongZi(number) {
      return function(power) {
        return Math.pow(power, number);
      }
    }
    const power2 = makeGongZi(2);
    console.log(power2(3));

    function makeFun() {
      return function() {
        console.log(123);
      }
    }
    const a = makeFun();
    // a();

    // closure 闭包
    // closure 闭包
    // closure 闭包

    // 柯里化函数
    const curry = function(reg) {
      return function(str) {
        return str.match(reg);
      }
    }
    const hasEmpty = curry(/\s+/g);
    console.log(hasEmpty)
  </script>
</body>
</html>